version: '3.8'
services:
  postgres:
    image: postgres
    environment:
      POSTGRES_DB: DB
      POSTGRES_USER: ADMIN
      POSTGRES_PASSWORD: ROOT
    ports:
      - "5432:5432"
    volumes:
      - pgdata:/var/lib/postgresql/data

  pgadmin:
    image: dpage/pgadmin4
    environment:
      PGADMIN_DEFAULT_EMAIL: admin@admin.com
      PGADMIN_DEFAULT_PASSWORD: root
    ports:
      - "5050:80"

  nestapp:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=postgres://ADMIN:ROOT@postgres/DB
    depends_on:
      - postgres

volumes:
  pgdata:
